package com.xzzz.irda.guardcat.core.metric.rocketmq;

import com.xzzz.irda.guardcat.core.metric.GuardcatRocketMqController;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author xzzz
 */
@Slf4j
@Configuration
@ConditionalOnClass(RocketMQTemplate.class)
public class RocketMQMetricConfiguration {

    @Bean
    public RocketMQConsumerBeanPostProcessor consumerBeanPostProcessor () {
        return new RocketMQConsumerBeanPostProcessor();
    }

//    @Bean
//    public RocketMQProviderAspect providerAspect () {
//        return new RocketMQProviderAspect();
//    }

    @Bean
    public RocketMQMetricManager rocketMQMetricManager() {
        return new RocketMQMetricManager();
    }

    @Bean
    public GuardcatRocketMqController rocketMqMonitorController() {
        return new GuardcatRocketMqController();
    }

    @PostConstruct
    public void init() {
        log.info("[GUARDCAT] 检测到ROCKET_MQ, 监听ROCKETMQ");
    }
}
